package top.zlcode.file.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import top.zlcode.file.common.FileStoreConstants;

/**
 * 配置静态资源访问
 */
@Configuration
public class ResourceConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/file/**")
                .addResourceLocations("file:" + FileStoreConstants.BASE_PATH);
        WebMvcConfigurer.super.addResourceHandlers(registry);
    }
}
